set(LOCAL_MODULE bluetooth.default)

# HAL layer
set(LOCAL_SRC_FILES
	../btif/src/bluetooth.c)

# platform specific
set(LOCAL_SRC_FILES
	${LOCAL_SRC_FILES}
	bte_main.c 
	bte_init.c 
	bte_logmsg.c 
	bte_conf.c 
	stack_config.c
)

# BTIF
set(LOCAL_SRC_FILES
	${LOCAL_SRC_FILES}
    ../btif/src/btif_config.c 
#	../btif/src/btif_config_transcode.cpp 
    ../btif/src/btif_core.c 
    ../btif/src/btif_debug.c 
    ../btif/src/btif_debug_btsnoop.c 
    ../btif/src/btif_debug_conn.c 
    ../btif/src/btif_dm.c 
    ../btif/src/btif_gatt.c 
    ../btif/src/btif_gatt_client.c 
    ../btif/src/btif_gatt_multi_adv_util.c 
    ../btif/src/btif_gatt_server.c 
    ../btif/src/btif_gatt_test.c 
    ../btif/src/btif_gatt_util.c 
    ../btif/src/btif_hh.c 
    ../btif/src/btif_hl.c 
    ../btif/src/btif_sdp.c 
	../btif/src/btif_pan.c 
    ../btif/src/btif_profile_queue.c 
    ../btif/src/btif_sm.c 
    ../btif/src/btif_sock.c 
	../btif/src/btif_sock_rfc.c 
    ../btif/src/btif_sock_l2cap.c 
    ../btif/src/btif_sock_sco.c 
    ../btif/src/btif_sock_sdp.c 
	../btif/src/btif_sock_thread.c 
	../btif/src/btif_sdp_server.c 
    ../btif/src/btif_sock_util.c 
    ../btif/src/btif_storage.c 
    ../btif/src/btif_util.c 
    ../btif/src/stack_manager.c
)

if (SUPPORT_AUDIO)
set(LOCAL_SRC_FILES
	${LOCAL_SRC_FILES}
	../btif/src/btif_av.c 
    ../btif/src/btif_media_task.c 
    ../btif/src/btif_rc.c 
    ../btif/src/btif_hf.c 
    ../btif/src/btif_hf_client.c 
)
endif (SUPPORT_AUDIO)

# callouts
set(LOCAL_SRC_FILES
	${LOCAL_SRC_FILES}
    ../btif/co/bta_dm_co.c 
    ../btif/co/bta_hh_co.c 
    ../btif/co/bta_hl_co.c 
    ../btif/co/bta_pan_co.c 
    ../btif/co/bta_gattc_co.c 
    ../btif/co/bta_gatts_co.c
)
if (SUPPORT_AUDIO)
set(LOCAL_SRC_FILES
	${LOCAL_SRC_FILES}
    ../btif/co/bta_ag_co.c 
    ../btif/co/bta_av_co.c 
)
endif (SUPPORT_AUDIO)

# sbc encoder
set(LOCAL_SRC_FILES
	${LOCAL_SRC_FILES}
	../embdrv/sbc/encoder/srce/sbc_analysis.c 
	../embdrv/sbc/encoder/srce/sbc_dct.c 
	../embdrv/sbc/encoder/srce/sbc_dct_coeffs.c 
	../embdrv/sbc/encoder/srce/sbc_enc_bit_alloc_mono.c 
	../embdrv/sbc/encoder/srce/sbc_enc_bit_alloc_ste.c 
	../embdrv/sbc/encoder/srce/sbc_enc_coeffs.c 
	../embdrv/sbc/encoder/srce/sbc_encoder.c 
	../embdrv/sbc/encoder/srce/sbc_packing.c 
)

if (SUPPORT_AUDIO)
set(LOCAL_SRC_FILES
	${LOCAL_SRC_FILES}
	../udrv/ulinux/uipc.c)
endif (SUPPORT_AUDIO)

include_directories(
	$(CMAKE_CURRENT_SOURCE_DIR)/../ 
	$(CMAKE_CURRENT_SOURCE_DIR)/../bta/include 
	$(CMAKE_CURRENT_SOURCE_DIR)/../bta/sys 
	$(CMAKE_CURRENT_SOURCE_DIR)/../bta/dm 
	$(CMAKE_CURRENT_SOURCE_DIR)/../btcore/include 
	$(CMAKE_CURRENT_SOURCE_DIR)/../osi/include 
	$(CMAKE_CURRENT_SOURCE_DIR)/../gki/common 
	$(CMAKE_CURRENT_SOURCE_DIR)/../gki/ulinux 
	$(CMAKE_CURRENT_SOURCE_DIR)/../include 
	$(CMAKE_CURRENT_SOURCE_DIR)/../stack/include 
	$(CMAKE_CURRENT_SOURCE_DIR)/../stack/l2cap 
	$(CMAKE_CURRENT_SOURCE_DIR)/../stack/a2dp 
	$(CMAKE_CURRENT_SOURCE_DIR)/../stack/btm 
	$(CMAKE_CURRENT_SOURCE_DIR)/../stack/avdt 
	$(CMAKE_CURRENT_SOURCE_DIR)/../hcis 
	$(CMAKE_CURRENT_SOURCE_DIR)/../hcis/include 
	$(CMAKE_CURRENT_SOURCE_DIR)/../hcis/patchram 
	$(CMAKE_CURRENT_SOURCE_DIR)/../udrv/include 
	$(CMAKE_CURRENT_SOURCE_DIR)/../btif/include 
	$(CMAKE_CURRENT_SOURCE_DIR)/../btif/co 
	$(CMAKE_CURRENT_SOURCE_DIR)/../hci/include
	$(CMAKE_CURRENT_SOURCE_DIR)/../vnd/include 
	$(CMAKE_CURRENT_SOURCE_DIR)/../brcm/include 
	$(CMAKE_CURRENT_SOURCE_DIR)/../embdrv/sbc/encoder/include 
	$(CMAKE_CURRENT_SOURCE_DIR)/../embdrv/sbc/decoder/include 
	$(CMAKE_CURRENT_SOURCE_DIR)/../audio_a2dp_hw 
	$(CMAKE_CURRENT_SOURCE_DIR)/../utils/include 
	$(bdroid_C_INCLUDES) 
)

add_library(${LOCAL_MODULE} SHARED ${LOCAL_SRC_FILES})
set_target_properties(${LOCAL_MODULE} PROPERTIES PREFIX "")
find_package(ZLIB)
target_link_libraries(${LOCAL_MODULE} 
	libbt-brcm_gki
	libbt-brcm_stack
	libbt-brcm_bta
	libbtcore
	libosi
	libbtdevice
	libbt-hci
	libbt-vendor
	z  
	resolv  # for btsnoop
)

